package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.DishFlavor;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface DishMapper {
    Page<DishVO> select(DishPageQueryDTO dishPageQueryDTO);
    DishVO selectById(Long id);
    List<DishFlavor> getFlavorsByid(Long id);
    List<Dish> getDishByCategoryId(Long categoryId);

    @AutoFill(value = OperationType.UPDATE)
    void update(Dish dish);

    Long getIdByName(String dishName);//根据name查找id

    @AutoFill(value = OperationType.INSERT)
    void insert(Dish dish);

    void insertFlavor(DishFlavor dishFlavor);

    void deleteFlavor(DishFlavor flavor);

    //根据id删除菜品
    void delete(Long id);

    List<DishFlavor> getFlavorsByDishId(Long id);
}
